package com.mycode.adapter07;

public class OperationAdapter implements ScoreOperation {
    private QuickSort sort;
    private BinarySearch search;

    public OperationAdapter() {
        sort = new QuickSort();
        search = new BinarySearch();
    }

    @Override
    public int[] sort(int[] array) {
        // 调用适配者类 QuickSort 的排序方法
        return sort.quickSort(array);
    }

    @Override
    public int search(int[] array, int key) {
        // 调用适配者类 BinarySearch 的查找方法
        return search.binarySearch(array, key);
    }
}
